package com.lanyam.travel.base.service.impl;


import com.lanyam.travel.base.entity.SupplierInfo;
import com.lanyam.travel.base.entity.vo.SupplierInfoVo;
import com.lanyam.travel.base.dao.SupplierInfoMapper;
import com.lanyam.travel.base.service.ISupplierInfoService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;


@Service
@Transactional
@Slf4j
public class SupplierInfoServiceImpl implements ISupplierInfoService {

    @Resource
    private SupplierInfoMapper supplierInfoMapper;

    @Override
    public IPage<SupplierInfoVo> getPageSupplierInfo (Map<String, Object> queryMap, Integer page, Integer rows) {
        Page<SupplierInfoVo> pageSize = new Page<SupplierInfoVo>(page, rows);
        Page<SupplierInfoVo> pageInfo = supplierInfoMapper.getPage(pageSize, queryMap);
        return pageInfo;
    }

    @Override
    public void addSupplierInfo(SupplierInfo supplierInfo) {
        supplierInfoMapper.insert(supplierInfo);
    }

    @Override
    public void updateSupplierInfo(SupplierInfo supplierInfo) {
        supplierInfoMapper.updateById(supplierInfo);
    }

    @Override
    public void delById(String id) {
        supplierInfoMapper.delById(id);
    }

	@Override
	public List<SupplierInfo> getAllSupplier() {
		// TODO Auto-generated method stub
		return supplierInfoMapper.selectList(null);
	}

	@Override
	public SupplierInfo getSupplierById(String supplyId) {
		// TODO Auto-generated method stub
		return supplierInfoMapper.selectById(supplyId);
	}
}